{{define "user/login.html"}}
<!DOCTYPE html>
<!--
This is a starter template page. Use this page to start your new project from
scratch. This page gets rid of all links and provides the needed markup only.
-->
<html>
  <head>
		{{template "public/head.html"}}
<style>
    .bg {
    width: 100%;
    height: 100%;
    background: url("{{asset}}/images/bg.jpg") no-repeat center center;
    background-size: cover;
    margin: 0;
    padding: 0;
	}
</style>
  </head>
 <body class="hold-transition login-page bg">
    <div class="login-box">
      <div class="login-logo">
        <a ><b>R</b>estgo</a>
      </div><!-- /.login-logo -->
      <div class="login-box-body">
        <p class="login-box-msg">登录</p>

          <div class="form-group has-feedback">
            <input type="text" id="account" class="form-control" placeholder="请输入用户名">
            <span class="glyphicon glyphicon-user form-control-feedback"></span>
          </div>
          <div class="form-group has-feedback">
            <input type="password" id="passwd" class="form-control" placeholder="请输入密码">
            <span class="glyphicon glyphicon-lock form-control-feedback"></span>
          </div>
		
		 <div class="form-group has-feedback">
            <input type="text" id="code" class="form-control" placeholder="请输入下图验证码">
            
          </div>
		
		  <div class="form-group has-feedback" >
            
			<img id="verify" src="{{apiurl "/open/verify"}}" onclick="reloadverify($(this))" />
			<a href="javascript:reloadverify($('#verify'))">点击这里刷新验证码</a>
			
          </div>
			
          <div class="row">
            <div class="col-xs-8" style="padding-left:35px;">
              <div class="checkbox icheck">
                <label>
                  <input type="checkbox">记住账号,下次自动登录
                </label>
              </div>
            </div><!-- /.col -->
            <div class="col-xs-4">
              <button type="button" onclick="login()" class="btn btn-primary btn-block btn-flat">登录</button>
            </div><!-- /.col -->
          </div>


        <div class="social-auth-links text-center">
          <p>- OR -</p>
           <a href="{{pageurl "user/resetpwd"}}">忘记密码</a><br>
          <a href="{{pageurl "user/register"}}" class="text-center">注册成为会员</a>
        </div><!-- /.social-auth-links -->

        

      </div><!-- /.login-box-body -->
    </div><!-- /.login-box -->

    <script>

      function reloadverify(o){
          o.attr("src",'{{apiurl "/open/verify"}}?t='+new Date().getTime())
      }
      function login(){
          var data = {};
          data.verify = $("#code").val(),
          data.kword = $("#account").val(),
          data.passwd = $("#passwd").val()

          restgo.post("user/login",data).then(function(res){
                if(res.code!=200){
                    alert(res.msg)
                }else{
                    location.href = "{{pageurl "user/list"}}"
                }
          })
      }

    </script>
  </body>
</html>
{{end}}
